﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Abigail.Ui
{
    public partial class UiEditPassword : Form
    {
        Controller c;
        Model.User user;
        string userInitials;

        public UiEditPassword(Controller givenC, Model.User givenUser)
        {
            InitializeComponent();
            c = givenC;
            user = givenUser;
            userInitials = givenUser.Initials;

            this.Text = "Ändra lösenord för " + user.Initials;
            this.Show();
        }

        private void btn_cancel_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void btn_save_Click(object sender, EventArgs e)
        {
            c.ChangePassword(txt_password.Text, txt_passwordRepeat.Text, userInitials, this);
        }
    }
}
